package com.ocean.recommendationserver.realtimerecommend.controller;


import com.alibaba.fastjson.JSONObject;
import com.ocean.recommendationserver.realtimerecommend.entity.StreamingRecommendation;
import com.ocean.recommendationserver.realtimerecommend.result.Result;
import com.ocean.recommendationserver.realtimerecommend.service.IStreamingRecommendationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ocean
 * @since 2021-07-18
 */
@RestController
@RequestMapping("/streaming-recommendation")
public class StreamingRecommendationController {

    @Autowired
    private IStreamingRecommendationService streamingRecommendationService;

    @PostMapping("/getStreamingRecommendationForAUser")
    public Result<List<StreamingRecommendation>> getStreamingRecommendationForAUser(@RequestBody JSONObject params){
            List<StreamingRecommendation> streamingRecommendationList = streamingRecommendationService.getStreamingRecommendationForAUser(params.getInteger("uid"));
            return Result.success(streamingRecommendationList);
    }

}
